package com.job.dao;

import com.job.pojo.Check;
import com.job.pojo.Money;
import com.job.pojo.Offer;
import org.apache.ibatis.annotations.*;

import java.util.HashMap;
import java.util.List;

@Mapper
public interface OfferDao {
    //查询：
    //查询所有
    @Select("select * from offer")
    List<Offer> selectAll();
    //查询姓名
    @Select("select * from offer where userName=#{userName}")
    List<Offer>selectName(Offer offer);
    //查询性别
    @Select("select * from offer where sex=#{sex}")
    List<Offer>selectSex(Offer offer);
    //查询日期
    @Select("select * from offer where offerTime=#{offerTime}")
    List<Offer>selectTime(Offer offer);
    //查询日期+sex
    @Select("select * from offer where offerTime=#{offerTime} and sex=#{sex}")
    List<Offer>selectSexTime(Offer offer);
    //时间下拉框：
    @Select({"select distinct (offerTime)from offer"})
    List<Offer> time();


    //查询通过面试/笔试
    @Select("select * from offer where pass=#{pass}")
    List<Offer> pass(Offer offer);



    //修改：

    @Update("update offer set offerTime=#{offerTime}, email=#{email},pass=#{pass},userName=#{userName},sex=#{sex},birth=#{birth},phone=#{phone}" +
            " where userId=#{userId}")
    int update(Offer offer);

    //增加：
    @Insert("insert into offer(userName,userId,sex,birth,phone,email,offerTime,pass)" +
            "value(#{userName},#{userId},#{sex},#{birth},#{phone},#{email},#{offerTime},#{pass})")
    int add(Offer offer);

    //删除：
    @Delete("delete from offer where userId=#{userId} ")
    int del(Offer offer);



}
